package com.agileboot.domain.system.tag.dto;

import com.agileboot.domain.common.cache.CacheCenter;
import com.agileboot.domain.system.tag.db.SysTagEntity;
import com.agileboot.domain.system.user.db.SysUserEntity;
import java.util.Date;
import lombok.Data;

/**
 * 标签 DTO
 * 仿照 NoticeDTO
 */
@Data
public class TagDTO {

    public TagDTO(SysTagEntity entity) {
        if (entity != null) {
            this.tagId = entity.getTagId() + "";
            this.tagName = entity.getTagName();
            this.tagType = entity.getTagType();
            this.status = entity.getStatus();
            this.remark = entity.getRemark();
            this.createTime = entity.getCreateTime();

            SysUserEntity cacheUser = CacheCenter.userCache.getObjectById(entity.getCreatorId());
            if (cacheUser != null) {
                this.creatorName = cacheUser.getUsername();
            }
        }
    }

    private String tagId;

    private String tagName;

    private Integer tagType;

    private Integer status;

    private String remark;

    private Date createTime;

    private String creatorName;
}
